<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Petugas extends CI_Controller {

    function __construct() { //inisialisasi library dan helper yang perlu di load
        parent::__construct();
        $this->load->helper('form');
        $this->load->model('berbah');
        $log = $this->session->all_userdata();
        if (!isset($log) || $log['login'] != TRUE) {
            redirect('main');
        }
    }

    function index() {
        redirect('petugas/home');
    }

    function home() {
        $data['title'] = 'Home';
        $data['username'] = $this->session->userdata('username');
        if ($data['isi'] = $this->berbah->get_sys()) {
            $data['isi'] = $this->berbah->get_sys();
        } else {
            $data['isi'] = array();
        }
        $this->load->view('template/head',$data);
        $this->load->view('template/menu');
        $this->load->view('template/alert',$data);
        $this->load->view('petugas/home', $data);
        $this->load->view('template/foot');
    }

    function agama() {
        $data['title'] = 'Agama';
        $data['home'] = null;
        $data['agama'] = 'active';
        $this->load->view('agama', $data);
    }

    function sex() {
        $data['title'] = 'Jenis Kelamin';
        $this->load->view('sex', $data);
    }
    
    function kk(){
        $data['title'] = 'Kartu keluarga';
        $data['username'] = $this->session->userdata('username');
        if ($data['isi'] = $this->berbah->get_sys()) {
            $data['isi'] = $this->berbah->get_sys();
        } else {
            $data['isi'] = array();
        }
        if ($data['kk'] = $this->berbah->get_kk()) {
            $data['kk'] = $this->berbah->get_kk();
        } else {
            $data['kk'] = array();
        }
        $this->load->view('template/head',$data);
        $this->load->view('template/menu');
        $this->load->view('template/alert',$data);
        $this->load->view('petugas/kk', $data);
        $this->load->view('template/foot');
    }

    function penduduk() {
        $data['title'] = 'Penduduk';
        $data['username'] = $this->session->userdata('username');
        if ($data['isi'] = $this->berbah->get_sys()) {
            $data['isi'] = $this->berbah->get_sys();
        } else {
            $data['isi'] = array();
        }
        if ($data['pndk'] = $this->berbah->get_pndk()) {
            $data['pndk'] = $this->berbah->get_pndk();
        } else {
            $data['pndk'] = array();
        }
        $this->load->view('template/head',$data);
        $this->load->view('template/menu');
        $this->load->view('template/alert',$data);
        $this->load->view('petugas/penduduk', $data);
        $this->load->view('template/foot');
    }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
